<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>调查核实</title>
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/css/custom.form.css">
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header"></div>
                <div class="layui-card-body">
                    <div class="dchs_table_div">
                        <div id="searchParam">
                            <div class="layui-form-item" style="margin-left: 10px">
                                <div class="layui-input-inline layui-form">
                                    <label for="checkKeShi"></label><select id="checkKeShi">
                                    <!--                    <option value="12101009100">请选择检查科室</option>-->
                                    <!--                    <option value="12101009100" selected>全局</option>-->
                                    <!--                    <option value="12101009141">检查一科</option>-->
                                    <!--                    <option value="12101009142">检查二科</option>-->
                                    <!--                    <option value="12101009143">检查三科</option>-->
                                    <!--                    <option value="12101009144">检查四科</option>-->
                                    <!--                    <option value="12101009145">检查五科</option>-->
                                </select>
                                </div>
                                <div class="layui-input-inline layui-form">
                                    <label for="tsDm"></label><select id="tsDm">
                                    <option value="0">请选择调查核实天数</option>
                                    <option value="0" selected>全部</option>
                                    <option value="1">10天</option>
                                    <option value="2">15天</option>
                                    <option value="3">20天</option>
                                    <option value="4">25天</option>
                                    <option value="5">30天</option>
                                    <option value="6">30天以上</option>
                                </select>
                                </div>
                                <div class="layui-input-inline ">
                                    <button class="layui-btn" onclick="search()" id="search">查询</button>
                                </div>
                            </div>
                        </div>
                        <table class="layui-hide" id="dchs_table" lay-filter="dchs_table"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

</body>
<script src="/layui/layui.all.js"></script>
<script src="/js/core.util.js"></script>
<script th:inline="none">
    //获取token
    var token = CoreUtil.getData("access_token");
    //地址栏转义token中的#号
    var tokenQuery = token.replace("#", "%23");
    var tableIns1;
    var table = layui.table;
    var form = layui.form;
    var layer = layui.layer;
    var $ = jQuery = layui.jquery;
    var laydate = layui.laydate;
    var tree = layui.tree;
    var startTime = null;
    var endTime = null;
    layui.config({
        base: '/'
    }).extend({
        eleTree: 'layui-ext/eleTree/eleTree'
    }).use(['table', 'laypage', 'layer', 'laydate', 'tree', 'eleTree'], function () {
        var whereParams = {
            "username": "0CF9F5103FA0429B8C0224AF56A1D63B",
            "password": "0CF9F5103FA0429B8C0224AF56A1D63B",
            "serviceId": "0014",
            "param": {
                "dchsDetailParams": {
                    "swjgDm": "12101009100",
                    "tsDm": "0"
                }
            }
        };
        tableIns1 = table.render({
            elem: '#dchs_table'
            , contentType: 'application/json'
            , headers: {"authorization": token}
            , where: whereParams
            , page: true
            , limits: [10]
            , url: '/attention/dchsdetail' //数据接口
            , method: 'POST'
            , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": CoreUtil.isEmpty(res.data) ? 0 : res.data.total, //解析数据长度
                    "data": CoreUtil.isEmpty(res.data) ? null : res.data.records //解析数据列表
                }
            }
            , cols: [
                [
                    {field: 'dchsbh', title: '调查核实编号'},
                    {field: 'nsrmc', title: '纳税人名称'},
                    {field: 'nsrsbh', title: '纳税人识别号'},
                    {field: 'xprq', title: '下派日期'},
                    {field: 'pfrmc', title: '下派人'},
                    {field: 'dcks', title: '调查科室'},
                    {field: 'dcry', title: '调查人员'},
                    {field: 'dcsc', title: '调查时长'}
                ]
            ]
            , toolbar: '#toolbar'
        });

        //初始化检查科室查询条件
        CoreUtil.sendPost("/attention/gy/getcurrentswjgjcks", null, function (res) {
            let datas = res.data;
            let options = "<option value = '00'>请选择检查科室</option><option value = '00' selected>全局</option>";
            for (let i = 0; i < datas.length; i++) {
                options += '<option value="' + datas[i].swjgDm + '">' + datas[i].swjgjc + '</option>';
            }
            $('#checkKeShi').append(options);
            // 更新select渲染
            form.render('select');
        });
    });

    //执行查询
    function search() {
        var whereParams = {
            "username": "0CF9F5103FA0429B8C0224AF56A1D63B",
            "password": "0CF9F5103FA0429B8C0224AF56A1D63B",
            "serviceId": "0014",
            "param": {
                "dchsDetailParams": {
                    "swjgDm": $("#checkKeShi").val(),
                    "tsDm": $("#tsDm").val()
                }
            }
        };
        //这里以搜索为例
        tableIns1.reload({
            where: whereParams
            , page: {
                curr: 1 //重新从第 1 页开始
            }
        });
    }
</script>
</html>